package com.leo.demo._26;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;

public class ExecutorManager {
    private static List<ExecutorService> executorServiceList = new ArrayList<>();

    public static boolean registry(ExecutorService executorService){
        System.out.println("注册executor到全局管理器中");
        return executorServiceList.add(executorService);
    }

    public static void closeAll(){
        System.out.println("正在关闭所有线程池");
        for (ExecutorService service:executorServiceList){
            service.shutdown();
        }
        System.out.println("所有线程池均已发出关闭信号");
    }
}
